Next, look in the Add command buttons Click event to see how to use this Employees collection class:
Private Sub cmdAdd_Click()
' Add information to the Employees class
moEmps.Add EmpID:=CLng(txtEmpID), _
FirstName:=txtFirst, _
Salary:=CCur(txtSalary), _
LastName:=txtLast
End Sub
This code uses the module-level Employees object to add the information from the form into the class. In this example, the Add method is called using the named arguments to make it clear which values are being passed.
Next, you can retrieve a particular Employee object by filling a value into the txtSearch text box and clicking the Display command button:
Private Sub cmdDisplay_Click()
Dim oEmp As Employee
If moEmps.Count > 0 Then
' Retrieve Search Criteria from Collection
Set oEmp = moEmps.Item(txtSearch)